start = _ @stylesheet _
stylesheet = (@$import/comment/$comment1/rule )*
rule = s:$selector _ "{" _ r:subrule* _ "}" _ {
   r=r.reduce((p,c)=>{
       if(Array.isArray(c)){
         let arr=c.filter(i=>i.length>0)
         arr=arr.reduce((pre,cur)=>{
             if(Array.isArray(cur)){
               return [...pre,...cur]
             }
             else{
               pre.push(cur)
             }
             return pre;
         },[])
         return [...p,...arr]
       }
       else{
         return [...p,c]
       }
    },[])
  return {

    selector:s,
    subRules:r
  }
}
subrule=@$declaration _ @($comment1/$comment)* /$comment/$comment1/@rule
selector = "::v-deep"* "/deep/"* ( id/at/ class/tag / universal) (combinator _ selector)*
class = "&"* "."* ident
id = "#" ident
at = "@" ident
tag = ident
universal = "*"
comment = _ s1:$"//" _ s2:$(!eol . )* _ {
  return s1+s2;
}
comment1 = _ @$"/*" _ @$(!"*/" .)* _ @$"*/" _
combinator = "+" / ">" / "~" / " " / "," /"::" /":"/"."
declaration = _ @$property _ @$":" _ @$value _ @$("!important")* _ @$";" / mixin
property = ident
value = (ident1 / number ) (" " value)*
ident = [a-zA-Z0-9_\-&\(\)]*
ident1 = ([a-zA-Z0-9_\-\%\(\)#$\.\,\+@"\:\/*] / [ \t\n\r])* 
mixin = _ "@" _ (![;{] .)* _ ";" _
number = [0-9]+ ("." [0-9]+)?
import = _ "@import" _ (!";" .)* _ ";" _
eol = '\r\n' / '\r' / '\n'
_ "whitespace"
  = [ \t\n\r]*